package com.hq.web.controller;

import javax.jms.Message;
import javax.jms.TextMessage;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.hq.common.activeMq.IActiveMqService;

@Controller
public class ActiveMQCtrl {

	@Autowired
	@Qualifier("jmsQueueTemplate")
	JmsTemplate jmsQueueTemplate;
	
	@Autowired
	IActiveMqService activeMqApp;
	
	@RequestMapping("/activeMqView")
	public ModelAndView tabClick(){
		ModelAndView mvAndView=new ModelAndView();
		mvAndView.setViewName("mq/activeMq");
		return mvAndView;
	}
	
	@RequestMapping("/sendMessage")
	@ResponseBody
	public JSONObject sendMsg(){
		JSONObject jsonObject=new JSONObject();
		jsonObject.put("success", true);
		activeMqApp.sendMsg();
		return jsonObject;
		
	}
}
